package cn.tedu.submarine;

import javax.swing.*;

/**
 * 多倍炸弹天使(潜艇)类
 */
public class RewardSubmarine extends SeaObject{
    private int rewardIndex = 0;

    public RewardSubmarine() {
        super(86, 83);
    }


    public void move() {//潜艇移动方法
        setX(getX() + getSpeed());
    }

    int rsIndex = 0;
    int moIndex = 0;
    int boomIndex = 0;
    public ImageIcon getImage() {//画天使（潜艇）
        if (isLive()) {
            if (++rsIndex % 10 == 0) {
                return Images.rewardsubm[rewardIndex++%6];
            } else {
                return Images.rewardsubm[rewardIndex%6];
            }
        }else {
            if (++moIndex % 10 == 0) {
                boomIndex++;
                if (boomIndex == 10) {
                    setState(REMOVE);
                    return Images.boommap[boomIndex-1];
                }
                return Images.boommap[boomIndex];
            } else {
                return Images.boommap[boomIndex];
            }
        }
    }
}
